package com.fanqiechaodan.redis.res;

import lombok.Data;
import org.springframework.http.HttpStatus;

/**
 * @author fanqiechaodan
 * @Classname Result
 * @Description
 */
@Data
public class Result<T> {

    private Integer code;

    private String msg;

    private T data;

    public Result(Integer code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static <T> Result<T> success(T data) {
        return new Result<>(HttpStatus.OK.value(), HttpStatus.OK.getReasonPhrase(), data);
    }
}
